﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace hse_2013_sudoku
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            dgv1.Rows.Add(9);
            label1.Text = "";
            Field a = new Field();
            a.Fill();
            int[,] q = a.Getmtr();
            for (int i = 0; i < q.GetLength(0); i++)
            {
                for (int j = 0; j < q.GetLength(1); j++)
                {
                    dgv1.Rows[i+1].Cells[j+1].Value = q[i, j].ToString();
                    label1.Text += q[i, j].ToString() + " ";
                    if (((j + 1) % 3 == 0) && (j + 1 != q.GetLength(0))) { label1.Text += "| "; }
                }
                label1.Text += "\n";
                if (((i + 1) % 3 == 0) && (i + 1 != q.GetLength(0)))
                {
                    //label1.Text += " ";
                    for (int z = 0; z < q.GetLength(0); z++)
                    {
                        label1.Text += "---";
                    }
                    label1.Text += "\n";
                }
            }
        }
    }
}
